package com.sourcetrip.raw.model;

/**
 * @author: ZhouBert
 * @date: 2020/11/16
 * @description:
 */
public class Worker implements Cloneable{

	private String name;

	private Skill skill;

	public Worker() {
	}

	public Worker(String name, Skill skill) {
		this.name = name;
		this.skill = skill;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Skill getSkill() {
		return skill;
	}

	public void setSkill(Skill skill) {
		this.skill = skill;
	}

	@Override
	public Object clone() throws CloneNotSupportedException {
		// 这是浅拷贝
		//return super.clone();
		// 这是深拷贝
		Worker cloneWorker = (Worker) super.clone();
		Skill skill = (Skill) cloneWorker.getSkill().clone();
		cloneWorker.setSkill(skill);
		return cloneWorker;
	}

	@Override
	public String toString() {
		return "Worker{" +
				"name='" + name + '\'' +
				", skill=" + skill +
				'}';
	}
}
